package com.wxxymaker.model.dao;

import com.wxxymaker.model.entity.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface AdminDao extends JpaRepository<Admin, Integer>, JpaSpecificationExecutor<Admin> {

    List<Admin> findByNameLike(String name);

    @Query(value = "select * from t_admin where binary username=?1", nativeQuery = true)
    Admin findByUsername(String username);

    @Query(value = "select * from t_admin where binary username=?1 and password=?2", nativeQuery = true)
    Admin findByUsernameAndPassword(String username, String password);
}
